package org.example.chm;/*
 * title:
 * author:
 * date:
 * description:
 * */


import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
//C:\Users\11924\Desktop\SQLyog.chm
//C:\Users\11924\Java\output\output.xml
public class chmtoxml {
    public static void main(String[] args) {
        try {
            // 读取CHM文件
            File chmFile = new File("C:\\Users\\11924\\Desktop\\SQLyog.chm");
            Document doc = Jsoup.parse(chmFile, "UTF-8", ""); // 使用jsoup解析CHM文件

            // 将解析后的内容输出为XML文件
            File xmlFile = new File("C:\\Users\\11924\\Java\\output\\output.xml");
            String xml = doc.outerHtml();
            FileUtils.writeStringToFile(xmlFile, xml, "UTF-8");

            System.out.println("XML文件生成成功：" + xmlFile.getAbsolutePath());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
